<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>忘记密码</title>
<!--    <script src="../js/vue.min.js"></script>-->
<!--    <script src="../js/axios.min.js"></script>-->
    <script src="http://47.106.66.89:8080/js/vue.min.js"></script>
    <script src="http://47.106.66.89:8080/js/axios.min.js"></script>
    <link  href="http://47.106.66.89:8080/js/ele-2.15.7/theme-chalk/index.css" rel="stylesheet">
    <script src="http://47.106.66.89:8080/js/ele-2.15.7/index.js"></script>
    <script src="js/txx.js"></script>
    <script src="lg/login.js"></script>
    <link rel="stylesheet" href="css/base.css">
    <style>
        .el-input{
            margin: 20px 0;
        }
    </style>
</head>
<body>
<div id="app">
    <my-header></my-header>
    <main class="c900 el-card" style="align-items: stretch; width: 600px; padding: 30px 50px">
        <el-container style="height: 500px">
            <el-aside width="10px">

            </el-aside>
            <el-container >
                <el-header style="background-image: none ;text-align: center;line-height: 60px;font-size: 20px" >忘记密码</el-header>
                <el-main>
                    <el-input type="password" v-model="user.password" placeholder="请输入内容">
                        <template slot="prepend">密码</template>
                    </el-input>

                    <el-input type="password" v-model="user.repwd" placeholder="请输入内容">
                        <template  slot="prepend">再次输入密码</template>
                    </el-input>

                    <el-input v-model="user.eamil" placeholder="请输入内容">
                        <template slot="prepend">邮箱</template>
                        <el-button slot="append" @click="send">发送验证码</el-button>
                    </el-input>

                    <el-input v-model="user.vcode" placeholder="请输入内容">
                        <template  slot="prepend">输入验证码</template>
                    </el-input>

                    <el-button type="primary" @click="update" style="margin: 0 230px">确定</el-button>

                </el-main>

            </el-container>
        </el-container>
    </main>

</div>

<script>
    var vue = new Vue({
        el:"#app",
        data:{
            user:{eamil:'',repwd:'',password:'', vcode:''},

        },
        methods:{
            update(){
                axios.get("/forget/updatePwd",{
                    params: this.user
                }).then(res=>{
                    if(res.data.code == 0){
                        this.$alert(res.data.msg)
                    }else{
                        this.$message(res.data.msg)
                        location.href = "../index.html"
                    }
                })
            },
            send(){
                axios.get("/forget/findEmail?eamil=" + this.user.eamil).then(res=>{
                    if(res.data.code == 0){
                        this.$alert(res.data.msg)
                        return;
                    }

                    axios.get("../vcodeEmail?email=" + this.user.eamil).then(res=>{
                        if(res.data.code == 1){
                            this.$message(res.data.msg)
                        }else{
                            this.$alert(res.data.msg)
                        }
                    })
                })
            }
        }
    })
</script>
</body>
</html>